<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/popper.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <title>sjg hello</title>
</head>
<body>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark" id="mynav">
</nav>
<div class="container">
    <div class="row">

        <div class="col">
        </div>

    </div>
</div>
<script src="/static/js/thesame.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        $('#btn_linux').click(function () {
            $.ajax({
                url: '/hello/linux_cmd/',
                type: 'GET',
                cache: false,
                success: function (data) {
                    $('#linux_result').html(data);
                }
            });
        });

$("#sjg_post").click(function () {
    username = $("#username").val();
    password = $("#password").val();
    info = {"username": username, "password": password};
    $.ajax({
        url: '/hello/ajaxpost/',
        type: 'post',
        cache: false,
        data: JSON.stringify(info),
        success: function (data) {
            $('#sjg_post_result').html(data);
        }
    });
});

$("#sjg_get").click(function () {
    username = $("#username").val();
    password = $("#password").val();
    $.ajax({
        url: '/hello/ajaxget/',
        type: 'get',
        cache: false,
        data:{
            username: username,
            password: password,
        },
        success: function (data) {
            $('#sjg_get_result').html(data);
        }
    });
});

        $("#sjg_ajax").click(function () {
            $("#sjg_ajax").attr('disabled','disabled');
            $.ajax({
                url: '/hello/ajax/',
                type: 'get',
                cache: false,
                success: function (data) {
                    $("#sjg_ajax").removeAttr('disabled');
                    $('#sjg_result').html(data);
                },
                error:function(request){
                    $('#sjg_result').html('sjg error!');
                },
                beforeSend: function(XMLHttpRequest){
                    $('#sjg_result').html('请求处理中...');
                }
            });
        });
    });

</script>

</body>
</html>